import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StashVO, StashForm, StashQuery } from '@/api/bus/stash/types';

/**
 * 查询熠星达仓库列表
 * @param query
 * @returns {*}
 */

export const listStash = (query?: StashQuery): AxiosPromise<StashVO[]> => {
  return request({
    url: '/bus/stash/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询熠星达仓库详细
 * @param stashId
 */
export const getStash = (stashId: string | number): AxiosPromise<StashVO> => {
  return request({
    url: '/bus/stash/' + stashId,
    method: 'get'
  });
};

/**
 * 新增熠星达仓库
 * @param data
 */
export const addStash = (data: StashForm) => {
  return request({
    url: '/bus/stash',
    method: 'post',
    data: data
  });
};

/**
 * 修改熠星达仓库
 * @param data
 */
export const updateStash = (data: StashForm) => {
  return request({
    url: '/bus/stash',
    method: 'put',
    data: data
  });
};

/**
 * 删除熠星达仓库
 * @param stashId
 */
export const delStash = (stashId: string | number | Array<string | number>) => {
  return request({
    url: '/bus/stash/' + stashId,
    method: 'delete'
  });
};
